package com.sxw.hw_student.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; // 继承自 ServiceImpl
import com.sxw.hw_student.system.mapper.SysuserMapper;
import com.sxw.hw_student.system.entity.Sysuser;
import com.sxw.hw_student.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class SysUserServiceImpl extends ServiceImpl<SysuserMapper, Sysuser> implements ISysUserService {

    @Autowired
    private SysuserMapper sysuserMapper;

    @Override
    public Sysuser findByName(String userName) {
        return sysuserMapper.selectOne(new QueryWrapper<Sysuser>().eq("user_name", userName));
    }

    @Override
    public boolean save(Sysuser sysUser) {
        return sysuserMapper.insert(sysUser) > 0;
    }
}
